<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>

	<title>ViewModel</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
  <!--[if IE 6]>
    <link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" />
  <![endif]-->
  <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  <script type="text/javascript" src="js/jquery-func.js"></script>
</head>
<body>
<?php
class ViewModel{
	private $data=array();//记录从Model层读到的数据
	private $render;//记录视图层文件名 user/listusers.php
	function __construct($template){
		//构建一个完整的路径名
        $file='Home/View/'.strtolower($template).'.php';//小写
        if(file_exists($file)){
        	$this->render=$file;
     }
	}
	function assign($variable,$value){
		$this->data[$variable]=$value;
	}
	function display(){
		//准备数据 然后包含视图层显示数据
		$data=$this->data;
		include "$this->render";
	}
}

?>
</body>
</html>